'use strict';

merchantService.$inject = ['$http'];

function merchantService($http) {

  return {
      getListsBystatus: getListsBystatus,
      getAlls: getAlls,
      block: block,
      pass: pass,
      reject: reject
  }

  function getListsBystatus(status) {
     return $http.get("/a/merchant/get/list/" + status);
  }

  function getAlls(){
     return $http.get("/a/merchant/gets");
  }

  function block(merchant ,status2){
     $http.post("http://10.222.29.187:8999/m/merchant/merchantUpdateFromA",{icnum:merchant.icNum, status2:status2, token:merchant.token});
     return $http.get("/a/merchant/update/" + merchant._id+"/"+status2);
  }

  function pass(id){  
    return $http.post("/a/merchant/pass",{id:id});
  }

  function reject(id,reason, callback){
    return $http.post("/a/merchant/reject",{id:id,reason:reason})
  }

}

module.exports = merchantService;